﻿using IBLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace ZG2ZK2API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ZKController : ControllerBase
    {
        public ZKController(IZKBLL bll)
        {
            Bll = bll;
        }

        public IZKBLL Bll { get; }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="y"></param>
        /// <returns></returns>
        /// 
        [HttpPost]
        public Task<int> Add(yhmodel y)
        {
            return Bll.Add(y);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// 
        [HttpGet]
        public Task<int> Delete(int id)
        {
           return Bll.Delete(id);
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpGet]
        public List<yhmodel> GetAll()
        {
           return Bll.GetAll();
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="y"></param>
        /// <returns></returns>
        /// 
        [HttpGet]
        public Task<int> Update(yhmodel y)
        {
            return Bll.Update(y);
        }
    }
}
